<?php

/**
 * user_id actions.
 *
 * @package    toolbase
 * @subpackage user_id
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class user_idActions extends ToolbaseApiActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeShow(sfWebRequest $request)
  {
    
    Toolbase::addStat( 'user_id' );
        
        $db = $this->getDB( $request );
        if( !is_object( $db ) ) {
                ToolbaseApi::apiPrint( $db, $request );
        }
        
        $result = ToolbaseUserId::getFromName( $request );
        
        if( !$result ) {
                
                ToolbaseApi::apiPrint( 
                        array( 
                                'error' => array( 
                                        'code' => 'nouser', 
                                        'info' => sprintf( '%s is not a valid user', $request->getParameter('name') ) 
                                ) 
                        ), $request );
                
                
        }
        
    $arr = ToolbaseApi::user_idList( $result );
    
    ToolbaseApi::apiPrint( $arr, $request );
  }
}

